FUNCTION TEST_BUBLE_SORT : BOOL
  VAR
    // 简单测试数组
    iArrData : ARRAY[0..4] OF INT := [5, 2, 8, 1, 9];
    bResult : BOOL;
    // 验证变量
    bPassed : BOOL := FALSE;
  END_VAR

  // 执行排序
  bResult := BUBBLE_SORT(ADR(iArrData), ARRAY_SIZE(iArrData));
  
  // 验证结果
  IF bResult THEN
    // 检查数组是否正确排序为 [1, 2, 5, 8, 9]
    IF iArrData[0] = 1 AND 
       iArrData[1] = 2 AND 
       iArrData[2] = 5 AND 
       iArrData[3] = 8 AND 
       iArrData[4] = 9 THEN
      bPassed := TRUE;
    END_IF;
  END_IF;

TEST_BUBLE_SORT := bPassed;
  
END_FUNCTION